/* indent size: 2 */

module.exports = app => {
  const DataTypes = app.Sequelize;

  const Model = app.model.define('user', {
    user_id: {
      type: DataTypes.INTEGER(10),
      allowNull: false,
      primaryKey: true,
      autoIncrement:true
    },
    wx_id: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue: DataTypes.literal('EMPTY STRING')
    },
    wx_name: {
      type: DataTypes.STRING(100),
      allowNull: false,
      defaultValue: DataTypes.literal('EMPTY STRING')
    },
    wx_pic: {
      type: DataTypes.STRING(500),
      allowNull: false,
      defaultValue: DataTypes.literal('EMPTY STRING')
    },
    open_id: {
      type: DataTypes.STRING(200),
      allowNull: false,
      defaultValue: DataTypes.literal('EMPTY STRING')
    },
    user_number: {
      type: DataTypes.INTEGER(12),
      allowNull: false
    },
    user_name: {
      type: DataTypes.STRING(50),
      allowNull: false
    },
    sex: {
      type: DataTypes.INTEGER(4),
      allowNull: false
    },
    phone: {
      type: DataTypes.STRING(11),
      allowNull: false,
      defaultValue: DataTypes.literal('EMPTY STRING')
    },
    type: {
      type: DataTypes.INTEGER(4),
      allowNull: false
    },
    credit_score: {
      type: DataTypes.INTEGER(10),
      allowNull: false
    },
    ctime: {
      type: DataTypes.TIME,
      allowNull: false,
      defaultValue: DataTypes.literal('CURRENT_TIMESTAMP')

    },
    mtime: {
      type: DataTypes.TIME,
      allowNull: false,
      defaultValue: DataTypes.literal('CURRENT_TIMESTAMP')
    },
    status: {
      type: DataTypes.INTEGER(4),
      allowNull: false
    }
  }, {
    tableName: 'user'
  });

  Model.associate = function() {

  }

  return Model;
};
